using System;
using System.Collections.Generic;
using DevExpress.Web.ASPxEditors;

namespace DMS.Web
{
	public class BasePage : System.Web.UI.Page
	{
		private static readonly IList<string> themes = new[] { "Glass", "BlackGlass", "RedWine", "PlasticBlue" };

		protected string GetThemeCookieName()
		{
			return "MyThemeName";
		}

		/* Page PreInit */
		protected void Page_PreInit(object sender, EventArgs e)
		{
			string themeName = "Glass";
			if (Page.Request.Cookies[GetThemeCookieName()] != null)
			{
				themeName = Page.Request.Cookies[GetThemeCookieName()].Value;
				if (!themes.Contains(themeName))
					themeName = themes[0];
			}

			string clientScriptBlock = "var DXCurrentThemeCookieName = \"" + GetThemeCookieName() + "\";";
			Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "DXCurrentThemeCookieName", clientScriptBlock, true);

			this.Theme = themeName;
		}

		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);
			Page.ClientScript.RegisterClientScriptInclude("Utilities", Page.ResolveUrl("~/Scripts/Utilities.js"));
		}

		
	}
}